<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
        xmlns:icecore="http://www.icefaces.org/icefaces/core"
       xmlns:ace="http://www.icefaces.org/icefaces/components"
       xmlns:ice="http://www.icesoft.com/icefaces/component"
       >
    <h:head>
        <title><ice:outputText>Punktegruppen bearbeiten</ice:outputText></title>
    </h:head>
    <h:body>
        <ui:composition template="WEB-INF/templates/lecture.xhtml">
            <ui:define name="content">
                
                <h:form>
                    <ice:outputText value="Gruppe erzeugen" />
                    <ice:commandButton value="erzeugen"
                                       action="#{sessionBean.user.createScoreGroup()}" />
                </h:form>
                <br />
                <br />
                <ice:dataTable value="#{editScoreGroup.scoreGroups}"
                               var="sg">
                    <ice:column>
                        <f:facet name="header"><ice:outputText value="Name" /></f:facet>
                        <ice:inputText value="#{sg.name}" />
                    </ice:column>
                    
                    <ice:column>
                        <f:facet name="header"><ice:outputText value="Name" /></f:facet>
                        <ice:selectManyListbox value="#{sg.categorys}"
                                               partialSubmit="true">
                            <f:selectItems value="#{lectureBean.lecture.exerciseCategories}" />
                        </ice:selectManyListbox>
                    </ice:column>
                    
                    <ice:column>
                        <f:facet name="header"><ice:outputText value="Mitglieder" /></f:facet>
                        <ice:repeat value="#{sg.users}"
                                    var="u">
                            <ice:outputText value="#{u.username}" />
                            <h:form><ice:commandLink value="x"
                                                    action="#{sg.removeUser(u)}" />
                            </h:form>
                        </ice:repeat>
                    </ice:column>
                    <ice:column>
                        <h:form>
                            <ice:selectOneMenu value="#{editScoreGroup.user}"
                                               partialSubmit="true">
                                <f:converter converterId="userConverter" />
                                <f:selectItems value="#{editScoreGroup.users}" />
                            </ice:selectOneMenu>
                            <ice:commandButton value="Hinzufügen"
                                               action="#{editScoreGroup.addUser(sg)}" />
                        
                        </h:form>                                
                        
                    </ice:column>
                </ice:dataTable>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
